#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QMenu>
#include <QAction>
#include <QGridLayout>
#include <QLabel>
#include <QSplitter>
#include <QTreeView>
#include <QTableView>
#include <QTextEdit>
#include <QDir>
#include "booktablemodel.h"

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void setTableContent(QString const &);
private:
    void createActions();
    void createMenus();
    void setupLayout();
private slots:
    void openFile();
    void viewPdf() const;
    void openDoiUrl() const;
    void onTableClicked(QModelIndex const & index);
    void createLib();
    void importPdf();
    void addBibItem();
    void exportList();
    void deleteItem();
    void revealInExplorer() const;
private:
    QMenu *fileMenu;
    QMenu *viewMenu;
    QMenu *importMenu;
    QMenu *exportMenu;

    QAction *openTeXFileAction;
    QAction *openPdfAction;
    QAction *openDoiUrlAction;
    QAction *createLibAction;
    QAction *importPdfAction;
    QAction *addBibItemAction;
    QAction *exportListAction;
    QAction *deleteItemAction;
    QAction *revealInExplorerAction;

    QSplitter *mainSplitter, *leftSplitter, *rightSplitter;
    QTreeView *treeView;
    QTableView *tableView;
    QTextEdit *detail;
    BookTableModel *bookModel;

    int currentRow, currentColumn;
    QDir * pwd;
};
#endif // MAINWINDOW_H
